package com.dao.impl;

import com.Bean.Fddate;
import com.Bean.RoomListThree;
import com.dao.StatisticsThreeDao;
import com.util.JdbcUtil;
import java.sql.SQLException;
import java.util.List;

public class StatisticsDaoThreelmpl implements StatisticsThreeDao {

    public List<RoomListThree> queryDatathree(RoomListThree roomListThree, Fddate fddate) throws IllegalAccessException, SQLException, InstantiationException {
        String sql="SELECT intime,ROUND(avg(lroomprice),2) lroomprice ,count(rid) rid, count(*) count from room_list  GROUP BY intime";

        if(fddate.getLastDay()!=null){
            sql+=  " HAVING intime BETWEEN  '"+fddate.getFristDay()+"'  and  '"+ fddate.getLastDay()+"'";
            System.out.println(sql);
        }
        sql+=" ORDER BY intime";
        return JdbcUtil.queryData(sql,RoomListThree.class);
    }

    @Override
    public int insert(RoomListThree roomListThree) throws SQLException {
        return 0;
    }

    @Override
    public List<RoomListThree> queryData(RoomListThree roomListThree) throws IllegalAccessException, SQLException, InstantiationException {
        return null;
    }

    @Override
    public int update(RoomListThree roomListThree) throws SQLException {
        return 0;
    }

    @Override
    public int deleteById(Object id) throws SQLException {
        return 0;
    }
}
